require(['./config'],() => {
	require(['template',"request"],(template,req)=>{
		class Registered{
			constructor() {
				this.init()
				this.action()
			}
			init(){				
				$('.zhuce').click(function(){	
					const xing = $('.xing').val()
					const ming = $('.ming').val()
					const username = $('.youjian').val()
					const password = $('.mima').val()
					const tel = $('.haoma').val()
					const year = $('.nian').val()
					const month = $('.yue').val()
					const day= $('.ri').val()
					
					const userList = localStorage.getItem('userList')
					let arr
					if(userList){
						// 有数据就push进userList中
						arr = JSON.parse(userList)
						arr.push({username,password,xing,ming,tel,year,month,day})
					}else{
						arr = [{username,password,xing,ming,tel,year,month,day}]
					}
					localStorage.setItem('userList',JSON.stringify(arr))
					alert('注册成功!')
					location.href = '../html/login.html'
				})							
			}
			action(){
				$('.xing').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.xing').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				$('.ming').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.ming').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				
				$('.youjian').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.youjian').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				
				$('.mima').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.mima').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				
				$('.haoma').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.haoma').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				
				$('.nian').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.nian').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				$('.yue').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.yue').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				$('.ri').focus(function(){
					$(this).css('border-color','#0070c9');
					$(this).css('box-shadow','0 0 6px rgba(0,112,201,.5)')
				})
				$('.ri').blur(function(){
					$(this).css('border-color','#ccc');
					$(this).css('box-shadow','none')
				})
				
			}
			
		}
		return new Registered();
	})
})
